.TH std::linear_congruential_engine::linear_congruential_engine 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::linear_congruential_engine::linear_congruential_engine \- std::linear_congruential_engine::linear_congruential_engine

.SH Synopsis
   linear_congruential_engine() :                                    \fB(1)\fP \fI(since C++11)\fP
   linear_congruential_engine(default_seed) {}
   explicit linear_congruential_engine( result_type value );         \fB(2)\fP \fI(since C++11)\fP
   template< class SeedSeq >                                         \fB(3)\fP \fI(since C++11)\fP
   explicit linear_congruential_engine( SeedSeq& seq );
   linear_congruential_engine( const linear_congruential_engine&         \fI(since C++11)\fP
   other );                                                          \fB(4)\fP (implicitly
                                                                         declared)

   Constructs the pseudo-random number engine.

   1) The default constructor.
   2) Constructs the engine with a seed value value. The engine's initial state is
   determined as follows:
     * If c % m == 0 and value % m == 0 are both true, the state is 1.
     * Otherwise, the state is value % m.
   3) Constructs the engine with a seed sequence seq. Given std::size_t(std::log2(m) /
   32) + 1 as k, the engine's initial state is determined as follows:
    1. Creates an invented array object a of length k + 3.
    2. Calls seq.generate(a + 0, a + k + 3).
    3. Let S be \\((\\sum^{k-1}_{j=0} a_{j+3} \\cdot 2^{32j}) \\mod m\\)(∑k-1
       j=0 a
       j+3·232j
       ) mod m.
    4. If both c % m == 0 and S == 0 are true, sets the engine's state to 1. Otherwise,
       sets the engine’s state to S.
   This overload participates in overload resolution only if SeedSeq meets the
   requirements of SeedSequence.
   4) The copy constructor. Upon construction, *this == other is true.

.SH Parameters

   value - seed value to use in the initialization of the internal state
   seq   - seed sequence to use in the initialization of the internal state

.SH Complexity

   1,2) Constant.
   3) Same as the complexity of the seq.generate call.
   4) Constant.

   Defect reports

   The following behavior-changing defect reports were applied retroactively to
   previously published C++ standards.

     DR    Applied to        Behavior as published         Correct behavior
   P0935R0 C++11      the default constructor was explicit made implicit

.SH See also

   seed    sets the current state of the engine
   \fI(C++11)\fP \fI(public member function)\fP
